# https://www.bilibili.com/video/BV1W7411G7wP?p=11&spm_id_from=pageDriver&vd_source=8bd7b24b38e3e12c558d839b352b32f4
import pandas as pd
import matplotlib.pyplot as plt

users = pd.read_excel('../resources/input_py_tools/011/Users.xlsx')
# 按总量排序
users['Total'] = users.Oct + users.Nov + users.Dec
users.sort_values(by='Total', inplace=True, ascending=True)
print(users)

# 柱形 叠加图
#users.plot.bar(x='Name', y=['Oct', 'Nov', 'Dec'], stacked=True)
# 条形 叠加图
users.plot.barh(x='Name', y=['Oct', 'Nov', 'Dec'], stacked=True)
plt.title('User Behavior')
plt.tight_layout()
plt.show()

